{extend name='common/_container'} {block name="content"}
<div class="row">
	<div class="col-sm-12">
		<div class="ibox float-e-margins">
			<div class="ibox-content"> 
				<div class="row row-lg"> 
					<div class="col-sm-12"> 
						<div class="row" id="searchGroup">
							<div class="col-sm-2">
								<div class="input-group">
									<div class="input-group-btn">
										<button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button">手机</button>
									</div>
									<input type="text" autocomplete="off" class="form-control" id="mobile" placeholder="手机" />
								</div>
							</div>
							<!-- search end -->
							<div class="col-sm-1">
								<button type="button" class="btn btn-success " onclick="CodeGoods.search()" id="">
									<i class="fa fa-search"></i>&nbsp;搜索
								</button>
							</div>
						</div>
						<div class="btn-group-sm" id="CodeGoodsTableToolbar" role="group">
						</div>
						<table id="CodeGoodsTable" data-mobile-responsive="true" data-click-to-select="true">
							<thead><tr><th data-field="selectItem" data-checkbox="true"></th></tr></thead>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
	var CodeGoods = {id: "CodeGoodsTable",seItem: null,table: null,layerIndex: -1};

	CodeGoods.initColumn = function () {
 		return [
 			{field: 'selectItem', checkbox: true},
 			{title: '编号', field: 'id', visible: true, align: 'center', valign: 'middle',sortable: true},
 			{title: '手机', field: 'mobile', visible: true, align: 'center', valign: 'middle',sortable: true},
 			{title: '身份证正面', field: 'sfzzm', visible: true, align: 'center', valign: 'middle',sortable: true,formatter:CodeGoods.sfzzmFormatter},
 			{title: '身份证反面', field: 'sfzfm', visible: true, align: 'center', valign: 'middle',sortable: true,formatter:CodeGoods.sfzfmFormatter},
 			{title: '行驶证正面', field: 'xszzm', visible: true, align: 'center', valign: 'middle',sortable: true,formatter:CodeGoods.xszzmFormatter},
 			{title: '行驶证反面', field: 'xszfm', visible: true, align: 'center', valign: 'middle',sortable: true,formatter:CodeGoods.xszfmFormatter},
 			{title: '车牌号', field: 'plate_no', visible: true, align: 'center', valign: 'middle',sortable: true},
 			{title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle',sortable: true},
 			{title: '证件类型', field: 'card_type', visible: true, align: 'center', valign: 'middle',sortable: true},
 			{title: '证件号码', field: 'id_card', visible: true, align: 'center', valign: 'middle',sortable: true},
 		];
 	};

	CodeGoods.sfzzmFormatter = function(value,row,index) {
		if(value){
			return "<a href=\"javascript:void(0)\" onclick=\"openImg('"+value+"')\"><img height='30' src="+value+"></a>";	
		}
	}

	CodeGoods.sfzfmFormatter = function(value,row,index) {
		if(value){
			return "<a href=\"javascript:void(0)\" onclick=\"openImg('"+value+"')\"><img height='30' src="+value+"></a>";	
		}
	}

	CodeGoods.xszzmFormatter = function(value,row,index) {
		if(value){
			return "<a href=\"javascript:void(0)\" onclick=\"openImg('"+value+"')\"><img height='30' src="+value+"></a>";	
		}
	}

	CodeGoods.xszfmFormatter = function(value,row,index) {
		if(value){
			return "<a href=\"javascript:void(0)\" onclick=\"openImg('"+value+"')\"><img height='30' src="+value+"></a>";	
		}
	}

	CodeGoods.formParams = function() {
		var queryData = {};
		queryData['offset'] = 0;
		queryData['mobile'] = $("#mobile").val();
		return queryData;
	}

	CodeGoods.check = function () {
		var selected = $('#' + this.id).bootstrapTable('getSelections');
		if(selected.length == 0){
			Feng.info("请先选中表格中的某一记录！");
			return false;
		}else{
			CodeGoods.seItem = selected;
			return true;
		}
	};

	CodeGoods.search = function() {
		CodeGoods.table.refresh({query : CodeGoods.formParams()});
	};

	$(function() {
		var defaultColunms = CodeGoods.initColumn();
		var url = location.search;
		var table = new BSTable(CodeGoods.id, Feng.ctxPath+"/Insurance.InsuranceUsers/index"+url,defaultColunms,20);
		table.setPaginationType("server");
		table.setQueryParams(CodeGoods.formParams());
		CodeGoods.table = table.init();
	});
</script>
{/block}